<?php include 'function.php'; ?>

<html>
    <head>
        
    </head>
    <body>
        
        <?php
        $sql='select * from students';
        $conn = connect($sql);
        
        $sql1='select * from staffs';
        $conn1 = connect1($sql1);
        
        ?>
        <table>
            <tr>
                <td>ID</td>
                <td>Names</td>
            </tr>
        <?php foreach ($conn as $conns):?>
            <tr>
                <td><?php echo $conns['ID']; ?></td>
                <td><?php echo $conns['Name']; ?></td>
            </tr>
           
        <?php        endforeach;?>
        </table>
        
        <?php echo 'danh sach nhan vien'?>
          <table>
            <tr>
                <td>ID</td>
                <td>Names</td>
            </tr>
        <?php foreach ($conn1 as $conn1s):?>
            <tr>
                <td><?php echo $conn1s['ID']; ?></td>
                <td><?php echo $conn1s['Name']; ?></td>
            </tr>
           
        <?php        endforeach;?>
        </table>
        
        <p>Thêm Xóa Sửa</p>   
        <?php
        include('config.php');
        if(isset($_POST['submit']))
        {
        $id=mysql_real_escape_string($_POST['ID']);
        $name=mysql_real_escape_string($_POST['Name']);
        $query1=mysql_query("insert into addd values('','$id','$name')");
        echo "insert into addd values('','$id','$name')";
        if($query1)
        {
        header("location:list.php");
        }
        }
        ?>
        <fieldset style="width:300px;">
        <form method="post" action="">
        ID: <input type="text" name="ID"><br>
        Name: <input type="text" name="Name"><br>
        <br>
        <input type="submit" name="submit">
        </form>
        </fieldset>
     
    </body>
    
</html>
   